#include <iostream>
#include <string>
using namespace std;

class Array {
  int matrix[3][3];

public:
  Array &operator<<(int matrix[3][3]) {
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        this->matrix[i][j] = matrix[i][j];
      }
    }
    return *this;
  };

  Array &operator>>(int matrix[3][3]) {
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        matrix[i][j] = this->matrix[i][j];
      }
    }
    return *this;
  };

  Array &operator+(Array &array) {
    int m2[3][3];
    array >> m2;
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        this->matrix[i][j] += m2[i][j];
      }
    }
    return *this;
  };

  void set(int i, int j, int val) { matrix[i][j] = val; }
};

int main() {
  int matrix[3][3] = {
      {1, 2, 3},
      {4, 5, 6},
      {7, 8, 9},
  };
  Array array;
  array << matrix;

  Array array2;
  array2 << matrix;

  Array array3 = array + array2;
  array3 >> matrix;

  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cout << matrix[i][j] << " ";
    }
    cout << endl;
  }
  cout << endl;
}
